import React, { Component } from 'react';
import { RouterStore } from 'mobx-react-router';
import { NavBar, Icon } from 'antd-mobile';
import './navBar.scss';

export interface BackToProps {
    routingStore: RouterStore;
}

export default class BackTo extends Component<BackToProps> {
    render(): JSX.Element {
        return (
            <div className="nav-back-container">
                <NavBar
                    className="nav-bar"
                    mode="light"
                    icon={<Icon type="left" />}
                    onLeftClick={() => this.props.routingStore.goBack()}
                    leftContent="返回"
                >
                {this.props.children}
                </NavBar>
            </div>
        );
    }
}